subroutine wmbej_t1bn_imnje(wmbej, iijka, & 
              t1, icore, fact)
!
use mod_iop
use mod_size
use mod_orbit
use mod_ioff 
implicit none
!
real*8, intent(in) :: fact
real*4, intent(in) :: wmbej(*)
real*4, intent(in) :: iijka(*)
!
real*4, intent(inout) :: t1(*), icore(*)
!
integer :: i, j, a, b, nsize, i0, i1, i2
integer, external :: idsymsoc
real*8, external :: dnrm2
!one should note that iiabj and wmbej was sort as <em, bj>
!this is to do wmbej = wmbej + t1(b,n)*<mn||je>
i0 = 1
i1 = i0 + nvvoo*isd
i2 = i1 + nvvoo*isd
!====EMBJ AAAA
!iijka(MN,JE)*t1(BN)
call itranspso(iijka(ioi2(1)), icore(i0), popa, popa, 0, popa, vrta, 1, 1) 
call iexpso(icore(i0), icore(i1), popa, vrta, 1, 0, popa, popa, 0, 1, 1) 
!
call VpqrmVsm_to_Vpqrs(icore(i1), t1(ifvo(1)), 1, 1, popa, & 
                  popa, vrta, 1, popa, vrta, icore(i0), 1, 1.d0, 0.d0, 1)
! tmpe(JE,MB)
call sstgenso(icore(i0), icore(i1), nsize, popa, vrta, popa, vrta, & 
              icore, 1, '2341')
call axpyso(nioi41, fact, icore(i1), 1, wmbej(ioi4(1)), 1)
!
!====EmBj ABAB
!iijka(mN,jE)*t1(BN)
call itranspso(iijka(ioi2(4)), icore(i1), popb, popa, 1, popb, vrta, 1, 1) 
call VpqrmVsm_to_Vpqrs(icore(i1), t1(ifvo(1)), 1, 1, popa, & 
                  popb, vrta, 1, popb, vrta, icore(i0), 1, 1.d0, 0.d0)
! tmpe(jE,mB)
call sstgenso(icore(i0), icore(i1), nsize, popb, vrta, popb, vrta, & 
   icore, 1, '2341')
call axpyso(nioi42, fact, icore(i1), 1, wmbej(ioi4(2)), 1)
!
!====embj BBBB
!
!iijka(mn,je)*t1(bn)
call itranspso(iijka(ioi2(3)), icore(i0), popb, popb, 0, popb, vrtb, 1, 1) 
call iexpso(icore(i0), icore(i1), popb, vrtb, 1, 0, popb, popb, 0, 1, 1) 
!
call VpqrmVsm_to_Vpqrs(icore(i1), t1(ifvo(2)), 1, 1, popb, & 
                  popb, vrtb, 1, popb, vrtb, icore(i0), 1, 1.d0, 0.d0, 1)
! tmpe(je,mb)
call sstgenso(icore(i0), icore(i1), nsize, popb, vrtb, popb, vrtb, & 
              icore, 1, '2341')
call axpyso(nioi43, fact, icore(i1), 1, wmbej(ioi4(3)), 1)
!
!====eMbJ BABA
!iijka(Mn,Je)*t1(bn)
!
call itranspso(iijka(ioi2(2)), icore(i1), popa, popb, 1, popa, vrtb, 1, 1) 
call VpqrmVsm_to_Vpqrs(icore(i1), t1(ifvo(2)), 1, 1, popb, & 
                  popa, vrtb, 1, popa, vrtb, icore(i0), 1, 1.d0, 0.d0)
! tmpe(jE,mB)
call sstgenso(icore(i0), icore(i1), nsize, popa, vrtb, popa, vrtb, &
              icore, 1, '2341')
call axpyso(nioi44, fact, icore(i1), 1, wmbej(ioi4(4)), 1)
!
!====EMbj AABB 
!iijka(Mn,jE)*t1(bn)=-iijka(nM,jE)*t1(bn)
call itranspso(iijka(ioi2(4)), icore(i0), popb, popa, 1, popb, vrta, 1, 1) 
call isymtrso(icore(i0), icore(i1), popb, vrta, 1, 0, popb, popa, 1, 1, 1) 
call VpqrmVsm_to_Vpqrs(icore(i1), t1(ifvo(2)), 1, 1, popb, & 
                  popb, vrta, 1, popa, vrtb, icore(i0), 1, 1.d0, 0.d0)
!---tmp(jE,Mb)
call sstgenso(icore(i0), icore(i1), nsize, popb, vrta, popa, vrtb, &
              icore, 1, '2341')
call axpyso(nioi45, -fact, icore(i1), 1, wmbej(ioi4(5)), 1)
!
!====emBJ BBAA 
!iijka(mN,Je)*t1(BN)=-iijka(Nm,Je)*t1(BN)
call itranspso(iijka(ioi2(2)), icore(i0), popa, popb, 1, popa, vrtb, 1, 1) 
call isymtrso(icore(i0), icore(i1), popa, vrtb, 1, 0, popa, popb, 1, 1, 1) 
!nsize = idsymsoc(1, popa, vrta, 1, zorb, zorb, 1)
call VpqrmVsm_to_Vpqrs(icore(i1), t1(ifvo(1)), 1, 1, popa, & 
                 popa, vrtb, 1, popb, vrta, icore(i0), 1, 1.d0, 0.d0) 
!--tmp(Je,mB)

!nsize = idsymsoc(1, popa, vrtb, 1, popb, vrta, 1)
!write(6,*)'norm of icore(0) bbaa', nsize, dnrm2(nsize, icore(i0), 1)
call sstgenso(icore(i0), icore(i1), nsize, popa, vrtb, popb, vrta, &
                 icore, 1, '2341') 
!nsize = idsymsoc(1, popa, vrtb, 1, popb, vrta, 1)
!write(6,*)'norm of icore(0) bbaa sstgen', nsize, dnrm2(nsize, icore(i1), 1)
call axpyso(nioi46, -fact, icore(i1), 1, wmbej(ioi4(6)), 1)
return
end
